gui/macOS: Avoid leaking objc objects added to arrays and dicts
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 26 Mar 2025 12:21:30 +0000 (13:21 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 27 Mar 2025 14:16:05 +0000 (14:16 +0000)
The array/dict will retain them

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/macOS/fileproviderxpc_mac_utils.mm

index eb385d1c428588c5ac9fe6cc17dee08ef80ac057..fe33492ad48b17e8842a88f8d0700eb5e0cd9b00 100644 (file)
@@ -78,7 +78,6 @@ NSArray<NSDictionary<NSFileProviderServiceName, NSFileProviderService *> *> *get
                 } else if (service == nil) {
                     qCWarning(lcFileProviderXPCUtils) << "Service is nil";
                 } else {
-                    [service retain];
                     [fpServices addObject:@{service.name: service}];
                 }
                 dispatch_group_leave(group);
@@ -191,7 +190,6 @@ NSArray<NSXPCConnection *> *connectToFileProviderServices(NSArray<NSDictionary<N
                     return;
                 }
 
-                [connection retain];
                 [connections addObject:connection];
                 dispatch_group_leave(group);
             }];